package org.example.dao.dto.commom;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.dao.dto.user.UserDto;
import org.example.dao.entity.user.UUser;

/**
 * @author 22449
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfo {

    private Long userId;
    private String userNickName;
    private String userIcon;

    private UserInfo(Builder builder) {
        userId = builder.userId;
        userNickName = builder.userNickName;
        userIcon = builder.userIcon;
    }

    public static final class Builder{
        private Long userId;
        private String userNickName;
        private String userIcon;

        public Builder(){

        }

        public Builder userId(Long val){
            userId = val;
            return this;
        }
        public Builder userNickName(String val){
            userNickName = val;
            return this;
        }
        public Builder userIcon(String val){
            userIcon = val;
            return this;
        }
        public UserInfo build(){
            return new UserInfo(this);
        }
    }

    public UserInfo(UUser user){
        this.userId = user.getId();
        this.userNickName = user.getNickName();
        this.userIcon = user.getIcon();
    }

    public UserInfo(UserDto userDto) {
       this(userDto.getUser());
    }


}
